import 'package:flutter/material.dart';

import './contacts.dart';

class Home extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _Home();
  }
}

class _Home extends State<Home>{
  TabController controller;
  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
          backgroundColor: Colors.white,
          leading:Center(
            child: Text("微信",style: TextStyle(fontSize: 20,color: Colors.black45),),
            ),


          flexibleSpace:Container(color: Colors.white10,),
          actions:<Widget>[
            IconButton(icon: Icon(Icons.search),),
            IconButton(icon: Icon(Icons.add_circle_outline),),


          ]
      ),
      body:Column(
        children: <Widget>[
          _widgetOptions.elementAt(_selectedIndex),
        ],
      ),
//      body: new TabBarView(controller: controller, children: <Widget>[
//            new Contacts(),

      bottomNavigationBar:BottomNavigationBar(
          items: [
        BottomNavigationBarItem(
          icon: Icon(Icons.add_circle_outline),
          title: Text(
            "dsd",
          ),
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.add_circle_outline),
          title: Text(
            "dsd",
          ),
        ),
        BottomNavigationBarItem(
          icon: Icon(Icons.add_circle_outline),
          title: Text(
            "dsd",
          ),
        ),
            BottomNavigationBarItem(
              icon: Icon(Icons.add_circle_outline),
              title: Text(
                "dsd",
              ),
            ),
      ],
       type: BottomNavigationBarType.fixed,
        currentIndex: _selectedIndex,
//        selectedItemColor: Colors.amber[800],
        onTap: _onItemTapped,
      ) ,


    );
  }
  int _selectedIndex = 0;
  static const TextStyle optionStyle = TextStyle(fontSize: 30, fontWeight: FontWeight.bold);
  static  List<Widget> _widgetOptions = <Widget>[
    new Contacts(),
    Text(
      'Index 0: Home',
      style: optionStyle,
    ),
    Text(
      'Index 1: Business',
      style: optionStyle,
    ),
    Text(
      'Index 2: School',
      style: optionStyle,
    ),
    //Contacts(),


  ];

  void _onItemTapped(int index) {
    setState(() {
      _selectedIndex = index;
      print("点击$_selectedIndex");
    });
  }
  showContactsPage(){
    return Contacts();
  }

}